﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BTv2.UserControls;
using MahApps.Metro.Controls;

namespace BTv2
{
    /// <summary>
    /// Interaction logic for Settings.xaml
    /// </summary>
    public partial class Settings : MetroWindow
    {
        private MainSettingsMenu _mainSettingsMenu;
        public Settings()
        {
            InitializeComponent();
            
        }

        public Settings(bool isAdm)
        {

            InitializeComponent();
            _mainSettingsMenu = new MainSettingsMenu(this);
            SettingsWindowContent.Content = _mainSettingsMenu;
            if (isAdm) _mainSettingsMenu.EnableAdmin();
        }

        public void OpenAdminSettings()
        {
            SettingsWindowContent.Content = new MainAdminMenu(this);
        }
        public void OpenDatabaseSettings()
        {
            SettingsWindowContent.Content = new AdminDatabase(this);
        }
        public void OpenSensorSettings()
        {
            SettingsWindowContent.Content = new SensorSettings(this);
        }

        public void OpenSensorGroupSettings()
        {
            SettingsWindowContent.Content = new SensorGroupSettings(this);
        }

        public void OpenMailingListSettings()
        {
            SettingsWindowContent.Content = new AdminMailing(this);
        }
        public void OpenUserSettings()
        {
            SettingsWindowContent.Content = new AdminUsersTab(this);
        }
        public void OpenRuleSettings()
        {
            SettingsWindowContent.Content = new RuleSettings(this);
        }

        public void OpenNotificationSettings()
        {
            SettingsWindowContent.Content = new NotificationSettings(this);
        }

        public void OpenMainSettings()
        {
            SettingsWindowContent.Content = _mainSettingsMenu;
        }

        //private void AdminTab_Loaded(object sender, RoutedEventArgs e)
        //{
        //   AdminTabContentControl.Content = new MainAdminMenu(this);

        //}


        //public void MailListsCLicked(object sender, RoutedEventArgs e)
        //{
        //    var mladminsection = new AdminMailing(this);
        //    AdminTabContentControl.Content = mladminsection;
        //    this.MouseRightButtonDown += ShowMailingMenu;
        //}

        //public void DatabaseClicked(object sender, RoutedEventArgs e)
        //{
        //    var admDB = new AdminDatabase(this);

        //    AdminTabContentControl.Content = admDB;
        //}
        //public void UsersClicked(object sender, RoutedEventArgs e)
        //{
        //    var admUsers = new AdminUsersTab();

        //    AdminTabContentControl.Content = admUsers;
        //    this.MouseRightButtonDown += ShowUsersMenu;
        //}

        //public void ShowMailingMenu(object sender, RoutedEventArgs e)
        //{
        //    this.Flyouts[0].IsOpen = !this.Flyouts[0].IsOpen;
        //}
 
        //public void ShowUsersMenu(object sender, RoutedEventArgs e)
        //{
        //    this.Flyouts[2].IsOpen = !this.Flyouts[2].IsOpen;
        //}

        //public void MailingListMenuBack(object sender, RoutedEventArgs e)
        //{
        //    AdminTabContentControl.Content = new MainAdminMenu(this);
        //    this.MouseRightButtonDown -= ShowMailingMenu;
        //    this.Flyouts[0].IsOpen = false;
        //}

        //public void DatabaseMenuBack(object sender, RoutedEventArgs e)
        //{
        //    AdminTabContentControl.Content = new MainAdminMenu(this);
        //}

        //public void UsersBackButtonClick(object sender, RoutedEventArgs e)
        //{
        //    AdminTabContentControl.Content = new MainAdminMenu(this);
        //    this.MouseRightButtonDown -= ShowUsersMenu;
        //    this.Flyouts[2].IsOpen = false;
        //}

        //private void MailListMenuAddButton_Click_1(object sender, RoutedEventArgs e)
        //{

        //    var mail = AdminTabContentControl.Content as AdminMailing;
        //    mail.CMLAddMailingListButton(sender, e);
        //    this.Flyouts[0].IsOpen = false;
        //}

        //private void UserAddButtonCick(object sender, RoutedEventArgs e)
        //{

        //    var userc = AdminTabContentControl.Content as AdminUsersTab;
        //    userc.AUA_Button_CLicked(sender, e);
        //    this.Flyouts[2].IsOpen = false;
        //}
   }

}
